// ======================================================================
// Copyright (C) 2013 Hell-Prototypes. / www.hellprototypes.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// ======================================================================
#ifndef HELL_VO_H
#define HELL_VO_H

#include <QWidget>
#include "usb.h"
#include <QFile>
#include "usb_thread.h"
#include "plot_wave_form.h"

namespace Ui {
class Hell_VO;
}

class Hell_VO : public QWidget
{
    Q_OBJECT
    
public:
    explicit Hell_VO(QWidget *parent = 0);
    ~Hell_VO();
    
private:
    Ui::Hell_VO *ui;

    /*variable*/
    USB_Thread *m_USB_Thread;
    char m_rle_data[USB_BULK_READ_LEN];

    t_circular_buffer m_circular_buffer_ctrl;
    int m_x_axis_sample_number;

    plot_wave_form *m_plot_wave_form;
    QList<double> m_x_axis_time_list;

    //QwtSystemClock m_sys_clock;

    /*function*/
    void ui_init();

    int get_sampling_interval(QString rate);

private slots:
    void process_rle_data(int data_len);
    void process_usb_error(int err_code);
    void note_message(QString msg);

    void on_pb_usb_connect_clicked(bool checked);
//    void on_comboBox_currentIndexChanged(int index);
    void on_cb_time_base_currentIndexChanged(int index);
    void on_cb_sampling_rate_currentIndexChanged(int index);
};

#endif // HELL_VO_H
